home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / phonev4.arc / TRIGCHG.ASM < prev    next >
Assembly Source File  |  1991-05-07  |  3KB  |  135 lines

  1. PSEG    SEGMENT PARA PUBLIC 'CODE'
  2. BEGIN   EQU     $
  3.         ASSUME  CS:PSEG, DS:PSEG, ES:PSEG, SS:NOTHING
  4.         ORG     100H
  5. MAIN    PROC    NEAR
  6. START   EQU     $
  7.         push    cs
  8.         push    cs
  9.         pop     ds
  10.         pop     es
  11.         MOV     DX, OFFSET CFH
  12.         MOV     AH, 09h
  13.         INT     21h
  14.         MOV     DI, OFFSET ARGS
  15.         CALL    GET_ARGS
  16.         INC     DI
  17.         mov     ax, word ptr [di]
  18.         mov     word ptr [num], ax
  19.         mov     cx, 2
  20.         mov     si, di
  21.         call    convert_to_binary_number
  22.  
  23.         MOV     DX, OFFSET DISAB
  24.         cmp     bx, 0
  25.         JZ      DO_IT
  26.  
  27.         MOV     DX, OFFSET TRIGMSG
  28.  
  29. DO_IT:  PUSH    DX
  30.         mov     ax, 69h
  31.         mov     cx, ax
  32.         INT     49h
  33.         CMP     AX, 1
  34.         JNE     NOT_INSTALLED
  35.         CMP     BX, 2
  36.         JNE     NOT_INSTALLED
  37.         CMP     CX, 3
  38.         JNE     NOT_INSTALLED
  39.         CMP     DX, 4
  40.         JNE     NOT_INSTALLED
  41.         POP     DX
  42.         MOV     AH, 09h
  43.         INT     21h
  44.         MOV     AX, 4C00h
  45.         INT     21h
  46.  
  47. NOT_INSTALLED:
  48.         MOV     DX, OFFSET NOT_IN
  49.         MOV     AH, 09H
  50.         INT     21h
  51.         JMP     BAD_EXIT
  52.  
  53.  
  54. NOT_GOOD:
  55.         MOV     DX, OFFSET BAD_MSG
  56.         MOV     AH, 09h
  57.         INT     21h
  58.  
  59. BAD_EXIT:
  60.         MOV     AX, 4C01h
  61.         INT     21h
  62. MAIN    ENDP
  63.  
  64.  
  65. ten             dw 10
  66. ARGS    DB 127 DUP(0)
  67. BAD_MSG DB "Invalid command line parameter",13,10,13,10
  68.         DB "SYNTAX:   TRIGCHG #",13,10,13,10
  69.         DB "# = a number from 0 to 99",13,10,13,10
  70.         DB "TRIGCHG 0  will DISABLE the phone line monitor",13,10,13,10,"$"
  71. CFH     DB 13,10,13,10,"Trigger-point changer by "
  72.         DB "CFHSoftware",13,10,13,10,"$"
  73. disab   DB "The PHONE monitor has been disabled",13,10,13,10,"$"
  74. trigmsg DB "The PHONE monitor will reboot the system on ring number "
  75. num     DB "  ",13,10,13,10,"$"
  76. NOT_IN  DB 13,10,"CFH's Phone monitor isn't installed!!!",13,10,"$"
  77.  
  78. ; get_args
  79. ; gets the command line information from the psp
  80. ;ENTRY:
  81. ;     di points to a 127 byte buffer into which you want the command line
  82. ;        info copied.
  83. ;EXIT:
  84. ;     cx contains the number of characters on the command line
  85. ;     di points to the "buffer" area into which the info was copied
  86. ;     all other registers previous values ARE preserved (i.e. not destroyed)
  87. get_args proc
  88.         push ax
  89.         push bx
  90.         push di
  91.         push si
  92.         push ds
  93.         mov ah, 62h
  94.         int 21h
  95.         push bx
  96.         pop ds
  97.         mov si, 80h
  98.         lodsb
  99.         xor ch, ch
  100.         mov cl, al
  101.         push cx
  102.         rep movsb
  103.         pop cx
  104.         pop ds
  105.         pop si
  106.         pop di
  107.         pop bx
  108.         pop ax
  109.         ret
  110. get_args endp
  111.  
  112. convert_to_binary_number proc
  113.         xor bx, bx
  114. @@:
  115.         xor ax, ax
  116.         lodsb
  117.         cmp al, 57
  118.         jg non_numeric
  119.         sub ax, 48
  120.         jl non_numeric
  121.         push ax
  122.         mov ax, bx
  123.         mul ten
  124.         mov bx, ax
  125.         pop ax
  126.         add bx, ax
  127. space:  loop @b
  128. non_numeric:
  129.         ret
  130. convert_to_binary_number endp
  131.  
  132. PRG_END EQU     $
  133. PSEG    ENDS
  134.         END     MAIN
  135.